export interface User {
  id: string
  openid: string
  nickname: string
  avatar: string
  phone?: string
  createTime: string
  updateTime: string
}

export interface LoginParams {
  code: string
  encryptedData?: string
  iv?: string
}

export interface LoginResponse {
  token: string
  user: User
  isNewUser: boolean
}

export interface Court {
  id: string
  name: string
  description: string
  price: number
  images: string[]
  location: string
  facilities: string[]
  openTime: string
  closeTime: string
  status: 'available' | 'maintenance' | 'closed'
  createTime: string
  updateTime: string
}

export interface TimeSlot {
  id: string
  courtId: string
  date: string
  startTime: string
  endTime: string
  price: number
  status: 'available' | 'booked' | 'locked'
}

export interface Order {
  id: string
  orderNo: string
  userId: string
  courtId: string
  courtName: string
  date: string
  startTime: string
  endTime: string
  duration: number
  originalPrice: number
  discountPrice?: number
  totalPrice: number
  status: 'pending' | 'paid' | 'confirmed' | 'completed' | 'cancelled' | 'refunded'
  paymentMethod?: 'wechat'
  paymentTime?: string
  refundTime?: string
  refundReason?: string
  createTime: string
  updateTime: string
}

export interface BookingParams {
  courtId: string
  date: string
  timeSlots: string[]
  remark?: string
}

export interface PaymentParams {
  orderId: string
  paymentMethod: 'wechat'
}

export interface PaymentResponse {
  prepayId: string
  paySign: string
  timeStamp: string
  nonceStr: string
  signType: string
}

export interface RefundParams {
  orderId: string
  reason: string
  refundAmount?: number
}

export interface RefundResponse {
  refundId: string
  refundAmount: number
  estimatedArrival: string
}